﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySqlSugar;
namespace ConsoleApp1.DB
{
    public class DBContext
    {
        private static readonly string reval = "server=127.0.0.1;user id=root;password=xgxxgx;persistsecurityinfo=True;port=3306;database=avno1";
        public static SqlSugarClient GetInstance()
        {
            SqlSugarClient db = new SqlSugarClient(reval);
            //db.IsEnableLogEvent = true;//Enable log events
            //db.LogEventStarting = (sql, par) => { Console.WriteLine(sql + " " + par + "\r\n"); };
            return db;

        }
        public static void MakeModels()
        {
            using (var db = DB.DBContext.GetInstance())
            {
                db.ClassGenerating.CreateClassFiles(db, (@"c:\Models"), "ConsoleApp1.Model");
            }

        }
    }
}
